import axios from 'axios'

const isDev = process.env.NODE_ENV === 'development'

const request = axios.create({
  baseURL: isDev ? 'http://rap2.taobao.org:38080/app/mock/253020' : 'http://daxun.kuboy.top/api'
})

request.interceptors.request.use((config) => {
  console.log('正在加载')
  return config
}, (error) => {
  return Promise.reject(error)
})

// 响应拦截器
request.interceptors.response.use((response) => {
  console.log('加载完毕')
  return response
}, (error) => {
  return Promise.reject(error)
})

export default request
